package com.kevin.design.structuralPattern.adapter;
// 对象适配器
public class ObjectAdapter {
    public static void main(String[] args) {
        Target target = new Adapter();
        target.m1();
        target.m2();
    }
}

interface Target{
    void m1();
    void m2();
}

class Adaptee1{
    public void a1(){
        System.out.println("adaptee1.a1");
    }
}

class Adaptee2{
    public void a1(){
        System.out.println("adaptee2.a1");
    }
}

class Adapter implements Target{
    private Adaptee1 adaptee1;
    private Adaptee2 adaptee2;

    public Adapter() {
        adaptee1 = new Adaptee1();
        adaptee2 = new Adaptee2();
    }

    @Override
    public void m1() {
        adaptee1.a1();
    }

    @Override
    public void m2() {
        adaptee2.a1();
    }
}


